﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Security.Principal;

namespace Update_Engine_2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            //Edit
            string Versionfile_remote = ""; // This should be a HTTP location of a .txt document.
            string appid = ""; // This id should be about 6 numbers, but can be anything you wish. this is so if mutiple copies of UE2 is on a single computer, versionfiles will not conflict.
            WebClient Download = new WebClient();
            Download.DownloadFile(Versionfile_remote, @"C:\ue2_" + appid +"_versionfile.txt");
            StreamReader tr = new StreamReader(@"C:\ue2_" + appid +"_versionfile.txt");
            label1.Text = "Latest Version: " + tr.ReadLine();

            label2.Text = "This OpenSource tool is built by Justin Allor, The Old Element"; // It would be nice if you kept this in. Thanks <3 DH ^.^'
        }

        private void button1_Click(object sender, EventArgs e)
        {
            // In the speechquotes you insert a HTTP location of one of the files for your application
            // Be aware by default it downloads to the location of the file.. to edit any of this
            // e.g filelocation/libs/ you would edit the second string as ' AppDomain.CurrentDomain.BaseDirectory + "libs/" + "filename.exe'

            //Use this line of code for each file you wish to update when updater is launched

            WebClient Download = new WebClient();
            Download.DownloadFile("", AppDomain.CurrentDomain.BaseDirectory + ""); 
        }
    }
}
